package com.face.zf.config;

import cn.smartjavaai.common.config.Config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @Author: (ﾉ ◠ ‿ ◠)ﾉ wangYu
 * @CreateTime: 2025-08-01
 * @IDE:IDEA
 * @ContactMe WECHAT-> wy10012311   QQ-> 1569350611
 * @Description:
 */
@Configuration
@Slf4j
public class SmartJavaAiConfig {
    @Value("${ai.cache.windows.path}")
    private String cacheWindowsPath;
    @Value("${ai.cache.linux.path}")
    private String cacheLinuxPath;

    @PostConstruct
    public void init() {
        String osName = System.getProperty("os.name").toLowerCase();
        String selectedCachePath = osName.contains("win") ? cacheWindowsPath : cacheLinuxPath;
        Config.setCachePath(selectedCachePath);
        String cachePathFromSystem = Config.getCachePathFromSystem();
        log.info("Ai模型的缓存地址为: {}", cachePathFromSystem);
    }
}

